<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box1 {
            border: 10px red solid;
        }
        .box2 {
            width: 100px;
            height: 100px;
            background-color: #bfa;
            float: left;
        }
        /*用box3来把box1撑起来，box2以脱离*/
        /*.box3 {*/
        /*    clear: both;*/
        /*}*/

        .box1::after {
            content: "";
            clear: both;
            display: block;
        }
    </style>
</head>
<body>
<div class="box1">
    <div class="box2"></div>

<!--    <div class="box3"></div>-->
</div>
</body>
</html>